
import 'package:flutter/material.dart';

void main() =>runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context){
    return MaterialApp(
        home:HYHomePage()
    );
  }
}

class HYHomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context){
    return Scaffold(
      appBar: AppBar(
        title: Text("基础widget"),
      ),
      body:HYHomeContent(),
    );
  }
}

class HYHomeContent extends StatefulWidget {
  const HYHomeContent({super.key});

  @override
  State<HYHomeContent> createState() => _HYHomeContentState();
}
/**
 * 编辑器快捷键配置
 * preferences>keymap>找到冲突的快捷键extract，修改快捷键
 *alt+z抽取成一个widget
 *
 */
class _HYHomeContentState extends State<HYHomeContent> {
  @override
  Widget build(BuildContext context) {
    return Container(
     // color: Colors.cyan,
      width: 200,
      height: 200,
      alignment: Alignment(-1,-1),
      padding: EdgeInsets.all(20),
      margin: EdgeInsets.all(20),
      child: Text("hello world",style:TextStyle(
          color:Colors.green,
          fontSize:40
      )),
      decoration: BoxDecoration(
        color: Colors.red,
        border: Border.all(
          width: 15,
          color: Colors.purple
        ),
        borderRadius: BorderRadius.circular(100),
        boxShadow: [
          BoxShadow(color: Colors.orange,offset: Offset(10,10))
        ]
      ),
    );
   }
}

class PaddingDemo extends StatelessWidget {
  const PaddingDemo({
    super.key,
  });

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: EdgeInsets.all(8.0),
      child: Text('你好，黄小腿',style: TextStyle(fontSize: 30,backgroundColor:Colors.red)),
    );
  }
}

class AlignDemo extends StatelessWidget {
  const AlignDemo({
    super.key,
  });

  @override
  Widget build(BuildContext context) {

    //   return Center(
    //       child: Icon(Icons.pets,size: 100)
    //   );
    //     return Align(
    //       alignment: Alignment(-1,-1),
    //       child: Icon(Icons.pets,size: 100),
    //     );
    return Container(
      width: 200,
      height: 200,
      color: Colors.red,
      child: Align(
        alignment: Alignment.topCenter,
        child: Icon(Icons.pets,size:50),
      ),
    );
  }
}


